<header>
    <div class="head-right">
        <button class="mdui-btn app-btn" mdui-drawer="{target: '#left-drawer'}">
            <span class="layui-badge-dot"></span>
            <i class="layui-icon">&#xe653;</i>
        </button>
        <div class="mdui-drawer mdui-drawer-right mdui-drawer-close" id="left-drawer">
            <ul class="mdui-list app-slide-menu app-collapse-menu" mdui-collapse="{accordion: true}">
                <li class="mdui-list-item mdui-ripple app-list-home ">
                    <a href="{:url('index/index/index')}" class="app-list-item-link mdui-text-left ">
                        <div class="mdui-list-item-content">
                            <i class="layui-icon">&#xe68e;</i>首页
                        </div>
                    </a>
                </li>
                {empty name="user_info"}
                <li class="mdui-collapse-item app-hide-list  app-collapse-list">
                    <a href="{:url('index/user/login')}" class=" mdui-list-item mdui-ripple  mdui-p-x-0">
                        <div class="menu-click mdui-list-item-content mdui-text-left">
                            登录/注册
                        </div>
                    </a>
                </li>
                {else /}
                <li class="mdui-collapse-item  app-hide-list  app-collapse-list">
                    <div class="mdui-collapse-item-header mdui-list-item mdui-ripple  mdui-p-x-0">
                        <div class="menu-click mdui-list-item-content mdui-text-left" onClick="">
                            {$user_info.username}
                            <i class="mdui-collapse-item-arrow mdui-icon material-icons mdui-float-right">
                                &#xe5cc;
                            </i>
                        </div>
                    </div>
                    <ul class="mdui-collapse-item-body mdui-list mdui-list-dense">
                        <li class="mdui-list-item mdui-ripple app-sub-list  app-hide-list">
                            <a href="{:url('index/user/index')}" class="app-list-item-link mdui-text-left">
                                个人信息
                            </a>
                        </li>
                        <li class="mdui-list-item mdui-ripple app-sub-list  app-hide-list">
                            <a href="{:url('index/user/change_password')}" class="app-list-item-link mdui-text-left">
                                修改密码
                            </a>
                        </li>
                        <li class="mdui-list-item mdui-ripple app-sub-list  app-hide-list">
                            <a id="logout" class="app-list-item-link mdui-text-left">
                                退出登录
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="mdui-collapse-item  app-hide-list  app-collapse-list">
                    <div class="mdui-collapse-item-header mdui-list-item mdui-ripple  mdui-p-x-0">
                        <div class="menu-click mdui-list-item-content mdui-text-left" onClick="">
                            车辆信息
                            <i class="mdui-collapse-item-arrow mdui-icon material-icons mdui-float-right">
                                &#xe5cc;
                            </i>
                        </div>
                    </div>
                    <ul class="mdui-collapse-item-body mdui-list mdui-list-dense">
                        <li class="mdui-list-item mdui-ripple app-sub-list  app-hide-list">
                            <a href="{:url('index/car/upload')}" class="app-list-item-link mdui-text-left">
                                车辆上传
                            </a>
                        </li>
                        <li class="mdui-list-item mdui-ripple app-sub-list  app-hide-list">
                            <a href="{:url('index/car/car_list')}" class="app-list-item-link mdui-text-left">
                                我的车辆
                            </a>
                        </li>
                    </ul>
                </li>
                {/empty}
                <!--无限级分类后台菜单 开始-->
                {volist name="firstnav" id="vo"}
                    {equal name="$vo.name" value="#"}
                        <li class="mdui-collapse-item  app-hide-list  app-collapse-list">
                            <div class="mdui-collapse-item-header mdui-list-item mdui-ripple  mdui-p-x-0">
                                <div class="menu-click mdui-list-item-content mdui-text-left" onClick="">
                                    {$vo.title}
                                    <i class="mdui-collapse-item-arrow mdui-icon material-icons mdui-float-right">
                                        &#xe5cc;
                                    </i>
                                </div>
                            </div>
                            <ul class="mdui-collapse-item-body mdui-list mdui-list-dense">
                                {volist name="$vo.SecNav" id="nav"}
                                    <li class="mdui-list-item mdui-ripple app-sub-list  app-hide-list">
                                        <a href="{$nav.name}" class="app-list-item-link mdui-text-left">
                                            {$nav.title}
                                        </a>
                                    </li>
                                {/volist}
                            </ul>
                        </li>
                    {else /}
                        <li class="mdui-collapse-item app-hide-list  app-collapse-list">
                            <a href="{$vo.name}" class=" mdui-list-item mdui-ripple  mdui-p-x-0">
                                <div class="menu-click mdui-list-item-content mdui-text-left">
                                    {$vo.title}
                                </div>
                            </a>
                        </li>
                    {/equal}
                {/volist}
            </ul>
        </div>
    </div>
</header>
<script>
    $(document).on('click','#logout',function(){
        layer.confirm('是否退出?', {icon: 3, title:'提示'}, function(index){
            $.ajax({
                url:"{:url('index/user/logout')}",
                type:'post',
                dataType:'json',
                success:function(res){
                    if (res.data == 1) {
                        layer.msg(res.message);
                        setTimeout(window.location.href="{:url('index/index/index')}",2000);
                    } else if (res.data == 0) {
                        layer.open({
                            title: '退出失败'
                            ,content: res.message
                        });
                    } else {
                        layer.open({
                            title: '退出失败'
                            ,content: '出现未知错误，如果问题一直出现，您可以联系管理员'
                        });
                    }
                },error:function () {
                    layer.open({
                        title: '退出失败'
                        ,content: '当前网络环境不安全，退出失败，请调整网络环境'
                    });
                }
            })
            layer.close(index);
        });
    });
</script>